<?php
if ($this->totalItem > 1) { 
	$urlOptionsCategory = array('module'=>'article','controller'=>'index','action'=>'category',
			'cid'=>$this->category['id'],
			'alias'=>$this->category['alias'],
	);
	$linkCategory = $this->url($urlOptionsCategory,'article-category');
?>
<div class="module_article">
	<div class="module_title clearfix">
		<span class="icon"></span>
		<h1 class="title"><a href="<?php echo $linkCategory;?>" title="<?php echo $this->category['name'];?>"><?php echo $this->category['name'];?></a></h1>
	</div>
	<div class="module_content">
	<?php
	foreach ( $this->Items as $key => $val ) {
		$name = $val ['name'];
		$picture = '<img class="img" src="' . $val ['thumb'] . '" alt="' . $val ['name'] . '"/>';
		$synopsis = nl2br($val ['synopsis']);
		
		$created = '';
		if($this->moduleConfig['showDate'] == 1){
			$created = new Zend_Date($val['created'],'dd-MM-YY h:s:i');
			$created = '<span class="date">' . $this->language['articleNgayDang'] . ': ' . $created . '</span>';
		}
		
		$hits = '';
		if($this->moduleConfig['showHits'] == 1){
			$hits = '<span class="hits">' . $this->language['articleXem'] . ': ' . $val['hits'] . '</span>';
		}
		
		$urlOptions = array ('module' => 'article', 'controller' => 'index', 'action' => 'detail', 'cid' => $val ['cat_id'], 'tcat' => $val ['category_alias'], 'title' => $val ['alias'], 'id' => $val ['id'] );
		$linkDetial = $this->url ( $urlOptions, 'article-detail' );
	?>
		<div class="item">
			<a href="<?php echo $linkDetial;?>" title="<?php echo $name;?>">
				<?php echo $picture;?>
			</a>
			<div class="desc">
				<h3 class="title">
					<a href="<?php echo $linkDetial;?>" title="<?php echo $name;?>"><?php echo $name;?></a>
				</h3>
				<div>
					<?php echo $created;?>
					<?php echo $hits;?>
				</div>
				<div class="synopsis"><?php echo $synopsis;?></div>
			</div>
			<div class="readmore">
				<a href="<?php echo $linkDetial;?>"><?php echo $this->language['xemThem']?></a>
			</div>
			<div class="clr"></div>
		</div>
		<?php
			}
		?>

		<?php
			if(!empty($this->arrParam['cid'])){
					
				$urlOptionsCategory = array('module'=>'article','controller'=>'index','action'=>'category',
						'cid'=>$this->arrParam['cid'],
						'alias'=>$this->arrParam['alias'],
				);
				$currentUrl = $this->url($urlOptionsCategory,'article-category');
			}else{
				$currentUrl = 'articles.html';
			}
			echo $this->paginationControl($this->paginator,'Sliding','pagination-index.phtml',array('currentUrl'=>$currentUrl,'arrParam' => $this->arrParam));
		?>
	</div>
	<div class="module_bottom"></div>
</div>
<?php
}else{
	$urlOptionsCategory = array('module'=>'article','controller'=>'index','action'=>'category',
			'cid'=>$this->category['id'],
			'alias'=>$this->category['alias'],
	);
	$linkCategory = $this->url($urlOptionsCategory,'article-category');
?>
	<div class="module_article">
		<div class="module_title clearfix">
			<span class="icon"></span> 
			<h1 class="title"><a href="<?php echo $linkCategory;?>" title="<?php echo $this->ItemArticle['name'];?>"><?php echo $this->ItemArticle['name'];?></a></h1>
		</div>
		<div class="module_content line180">
			<?php
				$name 			= $this->ItemArticle['name'];
				$content 		= htmlspecialchars_decode($this->ItemArticle['content']);
				echo $content;
			?>
		</div>
		<div class="module_bottom"></div>
	</div>
<?php			
} 
?>	


